<?php

namespace App\Http\Controllers\Api;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\Rentings;
use App\Models\Notice;

class NoticeController extends Controller
{
    //查看预约消息
    public function noticeList(Request $request){
         $openid = $request->get('openid');
         $renting_id = Rentings::where('openid',$openid)->value('id');
         //查看看房通知
         //这边使用with的作用就是 查出当前预约信息对应房东id的房东全部信息
         $data = Notice::with('owner')->where('renting_id',$renting_id)->orderBy('id','desc')->get();
         return $data;
    }
}
